package com.study.myupdate.presenter;

import com.study.myupdate.contract.UpdateContract;
import com.study.myupdate.model.UpdateModel;

public class UpdatePersenter implements UpdateContract.UpdatePresenter {
    private UpdateContract.UpdateView mView;
    private UpdateModel model;

    public UpdatePersenter(UpdateContract.UpdateView mView) {
        this.mView = mView;
        this.model = new UpdateModel();
    }

    @Override
    public void getServiceVersion(String url) {
        mView.showLoading();

        model.getServiceVersion(url, new UpdateModel.UpdateModelCallBack() {
            @Override
            public void onFailure(String msg) {
                mView.hideLoading();
                mView.showErroMsg(msg);
            }

            @Override
            public void onSuccess(String content) {
                mView.hideLoading();
                mView.serviceVersion(content);
            }
        });
    }

    @Override
    public void cancle() {

    }
}
